After completing this lesson, you'll be able to:
Renaming and - to a lesser extent - copying attributes are also important attribute functions within FME. When you rename an attribute, it ceases to exist under its prior name; when it is copied, it exists both in its new and old names.
The transformers capable of renaming an attribute are:
Transformer | Capability |
---|---|
AttributeCopier | Copy |
AttributeCreator | Copy |
AttributeManager | Copy and Rename |
AttributeRenamer | Rename |
The purpose of renaming is to manually enter a new name for a selected attribute. The old attribute is removed and replaced with the newly named one:
Here, an AttributeManager renames several fields by entering a different name for the Output Attribute. The Action is automatically set to Rename. Notice that the user also enters a new constant value for the PSTLCITY/PostalCity attribute.
You should rename attributes so your reader schema ('what you have') matches your writer schema ('what you want').
Although you can manually type a new attribute name into the Output Attribute field, if the transformer is connected to a writer feature type with the correct attributes, its attribute names will be automatically available for selection.
Depending on the transformer, copying an attribute can be one of two styles.
Here, a user configures an AttributeCopier by choosing an existing attribute and entering a new name. Again, when connected to a writer feature type, its schema is available so you can choose a matching attribute.
Note how both PSTLCITY and PostalCity exist on the transformer's output, proving that it is copying the attribute rather than renaming it.
For other transformers, the setup style is reversed: a new attribute is created and given the value of an existing attribute:
In this AttributeManager transformer, the user creates a new attribute (PostalCity) and assigns it the value from another (PSTLCITY). In effect, they have made a copy of the original attribute.